<?php
/**会员升级异步通知页*/
$out_trade_no = $_POST['order_id'];
$trade_status = $_POST['trade_status'];
$mysign = $_POST['mysign'];

require_once("memberup.config.php");
$cod_verify=new CodVerify($cod_config['key']);
$verify_result = $cod_verify->md5Verify($out_trade_no.$trade_status,$mysign);

if ($trade_status=='SUCCESS'&&$verify_result){
	include_once($config['webroot']."/module/payment/includes/payment_class.php");
	$payment= new payment();
	//支付流水号
	$trade_no = date('Y-m-d H:i:s', time());
	$cash_fee = 0;
	$payment->apply_shop($out_trade_no, $trade_no,$cash_fee,'WXPAY');
	echo 'success';
}else{
	////验证失败
    echo "fail";
    //调试用，写文本函数记录程序运行情况是否正常
    //logResult("这里写入想要调试的代码变量值，或其他运行的结果记录");
}
class CodVerify {
	
	var $signKey;
	
	function __construct($signKey){
		$this->signKey=$signKey;
	}
	
	
	
	function md5Verify($prestr, $sign) {
		$prestr = $prestr . $this->signKey;
		$mysgin = md5($prestr);
		
		if($mysgin == $sign) {
			return true;
		}
		else {
			return false;
		}
	}
	
	
}




